﻿<DemoContainer>
    <div class="mb-2">
        <a href="https://apexcharts.com/docs/zooming-in-category-x-axis/">Apex chart zooming-in-category-x-axis</a>
    </div>

    <ApexChart TItem="Order"
               Title="Order Net Value"
               XAxisType=XAxisType.Category
               Options=options>

        <ApexPointSeries TItem="Order"
                         Items="Orders"
                         Name="Gross Value"
                         XValue="@(e => e.Country)"
                         YAggregate="@(e => e.Sum(e => e.GrossValue))"
                         OrderByDescending="e=>e.Y"
                         SeriesType="SeriesType.Bar" />

        <ApexPointSeries TItem="Order"
                         Items="Orders"
                         Name="Net Value"
                         XValue="@(e => e.Country)"
                         YAggregate="@(e => e.Sum(e => e.NetValue))"
                         OrderByDescending="e=>e.Y"
                         SeriesType="SeriesType.Bar" />
    </ApexChart>
</DemoContainer>

@code {
    private List<Order> Orders { get; set; } = SampleData.GetOrders();
    private ApexChartOptions<Order> options = new ApexChartOptions<Order>();

    protected override void OnInitialized()
    {
        options.Xaxis = new XAxis { TickPlacement = TickPlacement.On };
    }

}

